﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLyPhongGiam
{
    public partial class frmDangNhap : Form
    {
        public frmDangNhap()
        {
            InitializeComponent();
        }

        private void btndangnhap_Click(object sender, EventArgs e)
        {
            string tenNguoiDung = txtTenNguoiDung.Text.ToString();
            string matKhau = txtMatKhau.Text.ToString();

            NguoiDung nguoiDung = Query.GetNguoiDung(tenNguoiDung, matKhau);

            if (nguoiDung != null)
            {
                MessageBox.Show("Đăng nhập thành công");
                this.Hide();
                string maSinhVien = txtTenNguoiDung.Text;
                Form main = new frmMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Ban dang nhap khong thanh cong !");
                txtTenNguoiDung.Text = "";
                txtMatKhau.Text = "";
                txtTenNguoiDung.Focus();
            }
        }
    }
}
